using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class TimeDelayPostChallengeAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public TimeDelayPostChallengeAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{""};
						validVersionCodes[HL7Version.v231] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
						validVersionCodes[HL7Version.v24] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
						validVersionCodes[HL7Version.v25] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
						validVersionCodes[HL7Version.v251] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
						validVersionCodes[HL7Version.v26] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
						validVersionCodes[HL7Version.v27] = new string[]{"BS","PEAK","TROUGH","RANDOM","1M","2M","3M","4M","5M","6M","7M","8M","9M","10M","15M","20M","25M","30M","1H","2H","2.5H","3H","4H","5H","6H","7H","8H","8H SHIFT","12H","24H","2D","3D","4D","5D","6D","7D","1W","10D","2W","3W","4W","1L","2L","3L"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{""};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 1/2 hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 1/2 hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 1/2 hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 1/2 hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 Â½ hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Baseline (time just before the challenge)","The time post drug dose at which the highest drug level is reached (differs by drug)","The time post drug dose at which the lowest drug level is reached (varies with drug)","Time from the challenge, or dose not specified. (random)","1 minute post challenge","2 minutes post challenge","3 minutes post challenge","4 minutes post challenge","5 minutes post challenge","6 minutes post challenge","7 minutes post challenge","8 minutes post challenge","9 minutes post challenge","10 minutes post challenge","15 minutes post challenge","20 minutes post challenge","25 minutes post challenge","30 minutes post challenge","1 hour post challenge","2 hours post challenge","2 Â½ hours post challenge","3 hours post challenge","4 hours post challenge","5  hours post challenge","6 hours post challenge","7 hours post challenge","8 hours post challenge","8 hours aligned on nursing shifts","12 hours post challenge","24 hours post challenge","2 days","3 days","4 days","5 days","6 days","7 days","1 week","10 days","2 weeks","3 weeks","4 weeks","1 month (30 days) post challenge","2 months (60 days) post challenge","3 months (90 days) post challenge"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
